<?php
include_once APPLICATION_DIR . "/application/model/RELATED_CATEGORY.php";

class Related_Category extends DataObjects_RELATED_CATEGORY
{
	public function arrayApplication($id_application)
	{
		$result = array();

		$this->ID_APPLICATION = $id_application;
		$this->find();
		while ($this->fetch()) {
			$result[] = $this->ID_CATEGORY;
		}
		return $result;
	}

	public function deleteApplication($id_application)
	{
		$this->ID_APPLICATION = $id_application;
		unset($this->ID_CATEGORY);
		$this->delete();
	}

	public function insertApplication($id_application, $arr)
	{
		if (is_array($arr))
		{
			$this->ID_APPLICATION = $id_application;

			foreach ($arr as $id)
			{
				$this->ID_CATEGORY = $id;
				$this->insert();
			}
		}
	}
}
?>